{extend name="base"}
{block name="cont"}
<style>
    body{
        background-color: #F8F8F8;
    }
</style>
<div class="cx-pos-r h30vh" style="overflow: hidden">
    {notempty name='$readdb.banber'}
    <div class="cx-bg-img cx-fex-c cx-fex-itemsc" style="background-image: url({$readdb.banber})"></div>
    {else/}
    {$wormedit.news_banner|raw|default=''}
    {/notempty}
</div>
<div class="layout cx-fex-l cx-fex-itemsc cx-pad-tb15 ll-pad-0 cx-bg-white">
    <div class="cx-cont cx-fex cx-fex-itemsc">
        <div class="cx-text-fbig ll-color ll-bold">{$readdb.title}</div>
        <div class="">
            <div class="cx-fex-l cx-fex-itemsc cx-hidden-l">
                <a href="/" class="cx-text-black-7" title="首页">
                    <i class="cx-icon cx-iconhome"></i>
                    <span>首页</span>
                </a>
                {volist name='menu' id='cx' empty=''}
                <a href="/home/part-{$cx.id}.html" target="_blank" title="{$cx.title}" class="cx-text-black-7">
                    <i class="cx-icon cx-iconright"></i>
                    <span>{$cx.title}</span>
                </a>
                {/volist}
                <a href="/home/article-{$readdb.id}.html" title="{$readdb.title}" target="_blank" class="cx-text-black-7">
                    <i class="cx-icon cx-iconright"></i>
                    <span>{$readdb.title|default=''}</span>
                </a>
            </div>
            <div class="cx-bor ll-bor-color cx-pad-lr10 cx-click cx-hidden cx-show-l" data-type="gengduolanmu" data-cid="#cx-cixi">
                <i class="cx-icon cx-iconmenu cx-text-f16 ll-color"></i>
            </div>
        </div>
    </div>
</div>
<div class="cx-mag-tb20 ll-mag-a0">
    <div class="cx-cont cx-fex-l">
        <div class="cx-xs19 cx-xl24  cx-bg-white cx-pad-a10 ll-pad-0 cx-bor-rasmall" style="box-shadow: 0 0 5px rgba(0,0,0,0.1)">
            <ul class="layout cx-fex-l">
                {volist name='listdb.data' id='cx' empty=''}
                <li class="cx-xs8 cx-xl12 cx-fex-l" data-scroll-reveal="enter bottom,move 50px,after 0.3s">
                    <a href="/home/article-{$cx['id']}.html?title={$cx.part_name}" title='{$cx['title']}' class="layout cx-pad-a10">
                    <div class="layout cx-pos-r cp">
                        <div class="layout cx-bg-img1x1">
                            <div class="cx-bg-img cx-fex-c cx-fex-itemsc cx-bg-white">
                                <img src="{$cx['picurl']}" class="cx-img-responsive" onerror="this.src='/public/wormcms/img/imgnone.jpg'" alt="">
                            </div>
                        </div>
                        <div class="cx-pos-a cx-fex-c cx-fex-itemsc item-cp cx-text-white cx-text-fbig" style="top: 0;left: 0;bottom:0;right: 0;background-color: rgba(0,0,0,0.5)">
                            {$cx['title']}
                        </div>
                    </div>
                    </a>
                </li>
                {/volist}
            </ul>
            <div class="layout cx-fex-c">
                <div class="cx-text-center" id="pages"></div>
            </div>
        </div>
        <div class="cx-xs5 cx-xl24 cx-pad-l20 ll-pad-0 cx-hidden-l " id="cx-cixi">
            <ul class="layout cx-fex-l cx-fex-column cx-fex-itemsc cx-bg-white cx-bor-rasmall cx-pad-a15" style="box-shadow: 0 0 5px rgba(0,0,0,0.1)" >
                <li class="layout leftpart cx-pad-b10 ll-pad-0 cx-borbottom cx-bor-white-1 cx-mag-b10">
                <span class="cx-text-f16 ll-bold ll-color cx-pad-tb10" style="border-bottom: 3px solid #0092fd">
                   {$readdb.title}
                </span>
                </li>
                <li class="layout leftpart cx-mag-tb5">
                    <a href="/home/part-4.html" target="_blank" title="{$cx.title}" class="layout cx-fex cx-pad-a10 cx-bg-white cx-bor-rasmall cx-bor cx-bor-white-1 ll-part">
                        <span>全部</span>
                        <i class="cx-icon cx-iconright"></i>
                    </a>
                </li>
                {notempty name='readdb.node'}
                {volist name='readdb.node' id='cx' empty=''}
                <li class="layout leftpart cx-mag-tb5">
                    <a href="/home/part-{$cx.id}.html" target="_blank" title="{$cx.title}" class="layout cx-fex cx-pad-a10 cx-bg-white cx-bor-rasmall cx-bor cx-bor-white-1 ll-part">
                        <span>{$cx.title}</span>
                        <i class="cx-icon cx-iconright"></i>
                    </a>
                </li>
                {/volist}
                {else/}
                {volist name='partlist' id='cx' empty=''}
                {eq name='cx.pid' value='$readdb.pid'}
                <li class="layout leftpart cx-mag-tb5">
                    <a href="/home/part-{$cx.id}.html" target="_blank" title="{$cx.title}" class="layout cx-fex cx-pad-a10 cx-bg-white cx-bor-rasmall cx-bor cx-bor-white-1 ll-part">
                        <span>{$cx.title}</span>
                        <i class="cx-icon cx-iconright"></i>
                    </a>
                </li>
                {/eq}
                {/volist}
                {/notempty}
            </ul>
            <div class="layout cx-mag-t20 cx-bg-white cx-bor-rasmall cx-fex cx-pad-lr15 last-child-remove-line cx-hidden-l" style="box-shadow: 0 0 5px rgba(0,0,0,0.1)">
                <div class="layout leftpart cx-pad-tb10 cx-borbottom cx-bor-white-1">
                <span class="cx-text-f16 ll-bold ll-color cx-pad-tb10" style="border-bottom: 3px solid #0092fd">
                   相关推荐
                </span>
                </div>
                {$wormedit.cptuijian|default=''|raw}
            </div>
        </div>
    </div>


</div>
<script>
    layui.use('laypage', function(){
        var laypage = layui.laypage,
            getUrlPapram = function (name) {
                let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"),
                    r = window.location.search.substr(1).match(reg); //匹配目标参数
                if (r != null) return unescape(r[2]);
                return null;
            };

        //执行一个laypage实例
        laypage.render({
            elem: 'pages',
            count: "{$listdb.total}",
            limit: "{$listdb.per_page}",
            curr:  "{$listdb.current_page}",
            theme: '#0092fd',
            jump: function(obj, first){
                let url = window.location.href;
                if(url.indexOf('page=') > 0){
                    let v = getUrlPapram('page');
                    url = v != null ? url.replace(`page=${v}`,`page=${obj.curr}`) : url.replace(`page=`,`page=${obj.curr}`);
                }else{
                    url = url.indexOf("?") > 0 ? url + `&page=${obj.curr}` : url + `?page=${obj.curr}`;
                }
                if(!first){
                    window.location.href = url;
                }
            }
        });
    });
    $('.part').each(function (index,item) {
        let num = $('.part').eq(index).data().class,
            id = $('.part').eq(index).data().id;
        postUrl(`/home/part-${id}.html`,'',function (res) {
            $('.part').eq(index).find(num).html(res.total)
        })
    });
    function postUrl (url, data = '', fun = '') {
        $.post(url, data, function (res) {
            if (typeof fun == "function") {
                fun(res);
            } else {
                if (res.code == '1') {
                    return true;
                } else if (res.code == '0') {
                    return false;
                }
            }
        }).fail(function () {
            // layer.closeAll('loading');
            // layer.alert('系统错误，请稍后再试！');
        });
    };
</script>
{/block}